<!--
 * @Author: Rachel 943701297@qq.com
 * @Date: 2022-09-04 14:15:09
 * @LastEditors: Rachel 943701297@qq.com
 * @LastEditTime: 2022-09-04 22:37:20
 * @FilePath: \JSCode\basic\index.html
 * @Description: 
 * 
 * Copyright (c) 2022 by Rachel 943701297@qq.com, All Rights Reserved. 
-->
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>垂直居中</title>
    <style>
      body {
        width: 100px;
        height: 100px;
        border: 1px solid black;
        position: relative;
      }
      .box {
        position: absolute;
        background: yellow;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        background-color: yellow;
      }
    </style>
  </head>
  <body>
    <div class="father">
      <div class="box">1111</div>
    </div>
  </body>
</html>
